package com.xuqi.DouBan;

import java.util.ArrayList;
import java.util.HashMap;

import android.R.integer;
import android.util.Log;

import com.xuqi.Search.UIC_SearchUrl;

public class UIC_DouBanSearchUrl extends UIC_SearchUrl
{

	public String m_cate = "";
	public int m_startIndex = 0;
	public int m_resultmax = 10;
	public String m_keyWord = "";
	public String m_responseType = "";
	public static final String JSON = "json";
	public static final String XML = "atom ";
	private static final String TAG = "UIC_DouBanSearchUrl";
	
	public UIC_DouBanSearchUrl()
	{
		super();
		// TODO Auto-generated constructor stub
		//set default
		setCate("movie");
		setStartIndex(1);
		setMaxResultNum(20);
		setResponseType(JSON);
		init();
	}
	
	public void init()
	{
		setApiKey("api", "047b6b607c1a2cd00d724221744e8670");
		setUrl("http://api.douban.com/");
		ArrayList<String> heads = new ArrayList<String>();
		heads.add(m_cate + "/subjects");
		setHeadURl(heads);
		
		ArrayList<String> params = new ArrayList<String>();
		params.add("q=" + m_keyWord);
		params.add("start-index=" + m_startIndex);
		params.add("max-results=" + m_resultmax);
		params.add("alt=" + m_responseType);
		setParams(params);
	}
	public void setCate(String cate)
	{
		m_cate = cate;
	}
	public void setStartIndex(int index)
	{
		m_startIndex = index;
	}
	public void setMaxResultNum(int num)
	{
		m_resultmax = num;
	}
	public void setKeyword(String keyword)
	{
		m_keyWord = keyword;
	}
	public void setResponseType(String type)
	{
		m_responseType = type;
	}
	@Override
	public String GetUrl()
	{
		// TODO Auto-generated method stub
		init();
		Log.d(TAG, getReqUrl());
		return getReqUrl();
	}
	
	
}
